﻿#pragma once
#include <QDebug>
#include <QString>

#include <mutex>
#include <vector>
struct AVCodecContext;
struct SwsContext;
struct AVFrame;

/// <summary>
/// 视频大小/格式转换器
/// </summary>
class VideoReScaler 
{

public:
	void Init(int inWidth, int inHeight, int inPixFmt, int outWidth, int outHeight, int outPixFmt);
	void StartScale(AVFrame* frame);
	void Release();
	VideoReScaler();
	~VideoReScaler();
private:
	std::mutex mMutex;               //编码器上下文锁
	SwsContext* swsCtx = nullptr;//像素格式转换
	int inWidth_;
	int inHeight_;
	int outWidth_;
	int outHeight_;
private:
	void PrintError(int err, QString msg);

};
